home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5602 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  53 lines

  1. Path: ix.netcom.com!netnews
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Does Borland C++ 5.0 still work with normal C???
  5. Date: Mon, 19 Feb 1996 22:48:45 GMT
  6. Organization: Netcom
  7. Message-ID: <3128ef57.265162433@nntp.ix.netcom.com>
  8. References: <n4mwd.33.000A228B@magg.net> <4gag3n$a5u@wormer.fn.net>
  9. NNTP-Posting-Host: ix-dc21-23.ix.netcom.com
  10. X-NETCOM-Date: Mon Feb 19  2:48:01 PM PST 1996
  11. X-Newsreader: Forte Agent .99d/32.182
  12.  
  13. joakley@wichita.fn.net (Jess J Oakley) wrote:
  14.  
  15. > n4mwd@magg.net (Dennis Hawkins) wrote:
  16. > >Does anybody know if the new Borland C++ compiler will compile normal C??  In 
  17. > >my opinion, if it doesn't, it is worthless.  I recently received a flyer from 
  18. > >Borland and there was no mention of being able to compile C.
  19. > Probably so,   Since as far as I know anything written in C is legal
  20. > within a  C++ program.   Obviously it wouldn't be a "TRUE"
  21. > C++ program.   
  22.  
  23. This just isn't true.  For example, the following is legal C but not
  24. C++:
  25.  
  26.     #include <stdlib.h>
  27.  
  28.     int main()
  29.     {
  30.       int* a = malloc(10 * sizeof a);
  31.       return 0;
  32.     }
  33.  
  34. There are also constructions that have different meanings in C and
  35. C++.  For example,
  36.  
  37.     #include <stdio.h>
  38.  
  39.     int main()
  40.     {
  41.       printf("%ld\n", (long) sizeof 'a');
  42.       return 0;
  43.     }
  44.  
  45. will print 1 in C++ but probably not in C (in C it will only if an int
  46. is the same size as char -- I'd be shocked if this is true in any
  47. Borland compiler).
  48.  
  49.  
  50. Michael M Rubenstein
  51.